package com.cheche.dn.common.listener;

import com.cheche.dn.common.IdWorker;
import com.cheche.dn.common.base.IdEntity;

import javax.persistence.PrePersist;

/**
 * Listener - ID生成
 * Created by cheshun on 15/8/22.
 */
public class IdListener {

    /**
     * 保存前处理
     *
     * @param id
     *            ID
     */
    @PrePersist
    public void prePersist(IdEntity id) {
        id.setId(IdWorker.INSTANCE.nextId());
    }
}
